import service from '@/utils/request'

const url = {
  login: '/login',
  verifymail: '/register/verifymail',
  codeverify: '/register/codeverify',
  register: '/register/register',
  resetPassword: '/login/resetPassword',
  resetCode: '/login/resetCode',
  logout: '/logout',
  islogin: '/islogin',
  getListById: '/homepage/getListById'
}

export const Entry = {
  // 登录
  login: function (params) {
    return service({
      url: url.login,
      method: 'post',
      data: params
    })
  },
  // 登出
  logout: function (params) {
    return service({
      url: url.logout,
      method: 'post',
      data: params
    })
  },
  islogin: function (params) {
    return service({
      url: url.islogin,
      method: 'post',
      data: params
    })
  },
  // 重置密码
  resetPassword: function (params) {
    return service({
      url: url.resetPassword,
      method: 'post',
      data: params
    })
  },
  //验证邮箱是否为机构邮箱
  verifymail: function (params) {
    return service({
      url: url.verifymail,
      method: 'post',
      data: params
    })
  },
  //验证邮箱验证码
  codeverify: function (params) {
    return service({
      url: url.codeverify,
      method: 'post',
      data: params
    })
  },
  //获取忘记密码验证码
  resetCode: function (params) {
    return service({
      url: url.resetCode,
      method: 'post',
      data: params
    })
  },
  register: function (params) {
    return service({
      url: url.register,
      method: 'post',
      data: params
    })
  },
  getListById: function (params) {
    return service({
      url: url.getListById,
      method: 'get',
      params: params
    })
  }
}
